/*
Navicat MySQL Data Transfer

Source Server         : 本机
Source Server Version : 50733
Source Host           : localhost:3306
Source Database       : hotel2

Target Server Type    : MYSQL
Target Server Version : 50733
File Encoding         : 65001

Date: 2021-02-23 00:09:24
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for customer
-- ----------------------------
DROP TABLE IF EXISTS `customer`;
CREATE TABLE `customer` (
`id`  int(11) NOT NULL AUTO_INCREMENT ,
`real_name`  varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`username`  varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`phone_number`  varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`delivery_address`  varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`password`  varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`status`  int(11) NULL DEFAULT NULL ,
`email`  varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`last_login_time`  timestamp NULL DEFAULT NULL ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
AUTO_INCREMENT=27

;

-- ----------------------------
-- Records of customer
-- ----------------------------
BEGIN;
INSERT INTO `customer` VALUES ('22', '张顾客', 'customer1', '15812345678', '1111111', '$2a$10$a4d3tEJa4ZO4uUrGmz4h4.NTD/GIfhR5wmxcZFWluey.c.xSD.mFq', '0', 'lihengfei@sdjzu.edu.cn', '2021-02-17 17:38:01'), ('23', '王顾客', 'customer2', '15812345678', '1111111', '$2a$10$bVKMAX6giNeiuqGFM1vnjOjWOgszDzYT8GIC1d8jmLwWhGWGtRB7G', '0', 'lihengfei@sdjzu.edu.cn', '2021-02-22 23:21:22'), ('24', '张顾客', 'customer3', '15812345678', '1111111', '$2a$10$iwrMSwIbnbfal1Uil0TRAOv.QieLHvb1gvqWc3uGAyp8U1taZUoiy', '0', 'lihengfei@sdjzu.edu.cn', '2021-02-16 22:10:04'), ('25', '张顾客', 'customer4', '15812345678', '1111111', '$2a$10$kk6Y35/1LrZeFs17GZO1AuKfNzaKzjhUfcDy/61YGb89o0yqizZme', '0', 'lihengfei@sdjzu.edu.cn', '2021-02-22 14:56:14'), ('26', '王顾客', 'customer6', '15812345678', '1111111', '$2a$10$hxQzzhiA6yci1QM9eYWBkue4NXqzTE3mhbj3FNnP5.9jSbng8kq9W', '0', 'lihengfei@sdjzu.edu.cn', '2021-02-22 14:56:25');
COMMIT;

-- ----------------------------
-- Table structure for food
-- ----------------------------
DROP TABLE IF EXISTS `food`;
CREATE TABLE `food` (
`id`  int(11) NOT NULL AUTO_INCREMENT ,
`food_name`  varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`food_type_id`  int(11) NULL DEFAULT NULL ,
`price`  decimal(10,2) NULL DEFAULT NULL ,
`mprice`  decimal(10,2) NULL DEFAULT NULL ,
`remark`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`img`  varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
PRIMARY KEY (`id`),
FOREIGN KEY (`food_type_id`) REFERENCES `foodtype` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
INDEX `FK_food_foodtype` (`food_type_id`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
AUTO_INCREMENT=9

;

-- ----------------------------
-- Records of food
-- ----------------------------
BEGIN;
INSERT INTO `food` VALUES ('6', '米饭', '6', '3.00', '2.60', '白米饭', 'upload/rice.jpg'), ('7', '西红柿炒鸡蛋', '7', '16.00', '15.00', '西红柿炒鸡蛋', 'upload/tomato_egg.jpg'), ('8', '糖醋鲤鱼', '1', '39.00', '35.00', '糖醋鲤鱼', 'upload/liyu.jpg');
COMMIT;

-- ----------------------------
-- Table structure for foodtype
-- ----------------------------
DROP TABLE IF EXISTS `foodtype`;
CREATE TABLE `foodtype` (
`id`  int(11) NOT NULL AUTO_INCREMENT ,
`type_name`  varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
AUTO_INCREMENT=8

;

-- ----------------------------
-- Records of foodtype
-- ----------------------------
BEGIN;
INSERT INTO `foodtype` VALUES ('1', '鲁菜'), ('4', '粤菜'), ('5', '川菜'), ('6', '主食'), ('7', '家常菜');
COMMIT;

-- ----------------------------
-- Table structure for order
-- ----------------------------
DROP TABLE IF EXISTS `order`;
CREATE TABLE `order` (
`id`  int(11) NOT NULL AUTO_INCREMENT ,
`customer_id`  int(11) NULL DEFAULT NULL ,
`order_time`  timestamp NULL DEFAULT NULL ,
`total_price`  decimal(10,2) NULL DEFAULT NULL ,
`order_status`  int(11) NULL DEFAULT 0 ,
PRIMARY KEY (`id`),
FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
INDEX `order_table_id` (`customer_id`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
AUTO_INCREMENT=19

;

-- ----------------------------
-- Records of order
-- ----------------------------
BEGIN;
INSERT INTO `order` VALUES ('18', '23', '2021-02-22 23:21:47', '58.00', '0');
COMMIT;

-- ----------------------------
-- Table structure for order_item
-- ----------------------------
DROP TABLE IF EXISTS `order_item`;
CREATE TABLE `order_item` (
`id`  int(11) NOT NULL AUTO_INCREMENT ,
`order_id`  int(11) NULL DEFAULT NULL ,
`food_id`  int(11) NULL DEFAULT NULL ,
`food_count`  int(11) NULL DEFAULT NULL ,
PRIMARY KEY (`id`),
FOREIGN KEY (`food_id`) REFERENCES `food` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
FOREIGN KEY (`order_id`) REFERENCES `order` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
INDEX `orderDetail_order_id` (`order_id`) USING BTREE ,
INDEX `order_item_food_id` (`food_id`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
AUTO_INCREMENT=40

;

-- ----------------------------
-- Records of order_item
-- ----------------------------
BEGIN;
INSERT INTO `order_item` VALUES ('37', '18', '6', '1'), ('38', '18', '7', '1'), ('39', '18', '8', '1');
COMMIT;

-- ----------------------------
-- Auto increment value for customer
-- ----------------------------
ALTER TABLE `customer` AUTO_INCREMENT=27;

-- ----------------------------
-- Auto increment value for food
-- ----------------------------
ALTER TABLE `food` AUTO_INCREMENT=9;

-- ----------------------------
-- Auto increment value for foodtype
-- ----------------------------
ALTER TABLE `foodtype` AUTO_INCREMENT=8;

-- ----------------------------
-- Auto increment value for order
-- ----------------------------
ALTER TABLE `order` AUTO_INCREMENT=19;

-- ----------------------------
-- Auto increment value for order_item
-- ----------------------------
ALTER TABLE `order_item` AUTO_INCREMENT=40;
